<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title></title>
    <link href="/resource/css/bootstrap.css" rel="stylesheet">
    <script type="text/javascript" src="/resource/js/jquery-3.2.1.js"></script>
    <script type="text/javascript" src="/resource/My97DatePicker/WdatePicker.js"></script>
</head>
<body>
    <form action="list" method="post">
        <a href="toadd"><input type="button" value="增加"></a><br>
       联络单号 <input type="text" name="danhao" value="${w.danhao}">
       类型:<select name="lxid" id="lxid">
             <option value="">请选择</option>
             <option value="0">制造部编号</option>
             <option value="1">制造部</option>
             <option value="2">配件编号</option>
             <option value="3">配件名称</option>
         </select>
       内容:<input type="text" name="neirong" value="${w.neirong}">
       备注: <input type="text" name="beizhu" value="${w.beizhu}">
       日期范围:<input type="text" onclick="WdatePicker()" name="mintime" value='<fmt:formatDate value="${w.mintime}" pattern="yyyy-MM-dd"></fmt:formatDate>'> -
        <input type="text" onclick="WdatePicker()" name="maxtime" value='<fmt:formatDate value="${w.maxtime}" pattern="yyyy-MM-dd"></fmt:formatDate>'>
        <input type="hidden" name="pageNum">
        <input type="submit" value="搜索">
        <table class="table">
            <tr>
                <th>报送日期</th>
                <th>联络单号</th>
                <th>制造部编号</th>
                <th>制造部</th>
                <th>配件编号</th>
                <th>配件名称</th>
                <th>金额</th>
                <th>加工检验</th>
                <th>采购人</th>
                <th>报销人</th>
                <th>备注</th>
                <th>操作</th>
            </tr>
            <c:forEach var="e" items="${info.list}">
                <tr>
                    <td><fmt:formatDate value="${e.bstime}" pattern="yyyy-MM-dd"></fmt:formatDate> </td>
                    <td>${e.danhao}</td>
                    <td>${e.zhizaobuid}</td>
                    <td>${e.zhizaobu}</td>
                    <td>${e.peijianid}</td>
                    <td>${e.pjname}</td>
                    <td>${e.money}</td>
                    <td><img src="${e.picurl}" width="50px" height="70px"> </td>
                    <td>${e.caigouren}</td>
                    <td>${e.baoxiaoren}</td>
                    <td>${e.beizhu}</td>
                    <td>
                        <a href="selectByid?danhao=${e.danhao}"><input type="button" value="修改"></a>
                        <input type="button" value="删除" onclick="sc('${e.danhao}')">
                    </td>
                </tr>
            </c:forEach>
            <tr>
                <td colspan="12">
                    <jsp:include page="/resource/page/pages.jsp"></jsp:include>
                </td>
            </tr>
        </table>
    </form>

<script>
    $("#lxid").val('${w.lxid}')
    function goPage(pageNum){
        $("[name='pageNum']").val(pageNum);
        $("form").submit();
    }

    function sc(danhao){
        if(confirm("确认要删除该信息吗")){
            $.ajax({
                type:"post",
                data: {danhao:danhao},
                url:"deleteByid",
                success:function(msg){
                    if(msg>0){
                        alert("删除成功");
                        location.reload();
                    }else{
                        alert("删除失败");
                        location.reload();
                    }

                }
            })
        }
    }
</script>
</body>


</html>